package LinearSearch;

import java.util.Random;

public class ArrayGenerator {//数组生成器

    private ArrayGenerator() {
    }

    public static Integer[] generateOrderedArray(int n) {//数组生成
        Integer[] arr = new Integer[n];//使用泛型需要使用包装类
        for (int i = 0; i < n; i++) {
            arr[i] = i;
        }
        return arr;
    }

    public static Integer[] generateRandomArray(int n, int bound) {//随机数组生成
        Integer[] arr = new Integer[n];//使用泛型需要使用包装类
        Random random = new Random();
        for (int i = 0; i < n; i++) {
            arr[i] = random.nextInt(bound);
        }
        return arr;
    }
}
